export const toast = ({
  title = "加载中",
  icon = "none",
  duration = 2000,
  mask = true
} = {}) => {
  /**
   * @description 显示消息提示框
   * @param {Object} 参数和showToast()保持一致
   */
  wx.showToast({
    title,
    icon,
    duration,
    mask
  })
}
export const modal = ({
  title = "提示",
  content = "您确定要执行此操作吗?",
  showCancel = true,
  confirmColor = "#f3514f"
} = {}) => {
  /**
   *  @description 显示模态对话框
   * @param {Object} 和showModal()参数一致
   */
  return new Promise((resolve) => {
    wx.showModal({
      title,
      content,
      showCancel,
      confirmColor,
      complete: (res) => {

        res.confirm && resolve(true)
        res.cancel && resolve(false)
      }
    })
  })
}
wx.modal = modal
wx.toast = toast